<?php
/**
 * Admin_NewsController
 * 
 * @author
 * @version 
 */
 
class Communication_EmailController extends Zen_Controller_Admin
{
    public function settingsAction(){
    	$file=APPLICATION_PATH."/modules/communication/settings/email.ini";
		$values=new Zend_Config_Ini($file);
		$values=$values->toArray();
		$form=new Communication_Form_Emailconfig();
		$form->setDefaults($values);
		
		
		if($this->_request->isPost()){
			if($form->isValid($this->_getAllParams())){
				$params=$form->getValues();
				$config=new Zend_Config(array_merge($values,$params));
				$writer=new Zend_Config_Writer_Ini();
				$writer->write($file,$config);
				$this->_helper->FlashMessenger->setNamespace ( 'messages' )->addMessage ( array ('text' => 'Изменения сохранены', 'type' => 'alert' ) );
				$this->_redirect($_SERVER['REQUEST_URI']);
			}
		}
		$this->view->form=$form;
		
    }
    
    
    
    
    
}